-- @owner: z@wan005
-- @date: 2023/5/18
-- @testpoint: weight_string函数作为关键字测试，部分测试点合理报错
--modified by zhanghuan96，2024-5-25，step2中设置参数为off，create database保持内核语法
--step1:查询系统表;expect:成功，为非保留关键字
select * from pg_get_keywords() where word ='weight_string';
--step2:作为数据库名;expect:成功
set dolphin.b_compatibility_mode=off;
drop database if exists weight_string;
create database weight_string dbcompatibility 'B';
drop database if exists weight_string;
reset dolphin.b_compatibility_mode;
--step3:作为列名和表名;expect:成功
drop table if exists weight_string;
create table weight_string(weight_string timestamp);
drop table if exists weight_string;
--step4:作为外部数据源名;expect:成功
drop data source if exists weight_string;
create data source weight_string;
drop data source if exists weight_string;
--step5:作为自定义函数名;expect:报错
create function weight_string(i integer)
returns integer
as $$
begin
    return i+1;
end;
$$ language plpgsql;
/

--step6:作为用户名;expect:成功
drop user if exists weight_string;
create user weight_string password 'Test_123';
drop user if exists weight_string;
--step7:作为别名;expect:成功
select 1 as weight_string, 2 as reverse;